package com.googlecode.jtoy.patterns.observer;

import java.util.LinkedList;
import java.util.List;

/**
 * @author shangxj
 * @date 6:38:30 PM, Jul 16, 2011
 */
public class Subject {

	private List<Observer> observers;

	public Subject() {
		observers = new LinkedList<Observer>();
	}

	public void registerObserver(Observer observer) {
		observers.add(observer);	
	}

	public void notifyObservers() {
		for (Observer o : observers) {
			o.update();
		}
	}
}
